package thread;

public class VolatileTest2 implements Runnable{
    private boolean flag = false;

    public static void main(String[] a) throws InterruptedException {
    	VolatileTest2 test = new VolatileTest2();
    	Thread t = new Thread(test);
    	t.start();
    	test.set();
    }
    
    public void set(){
    	flag = true;
    }

	@Override
	public void run() {
		if(flag){
			System.out.println(".");
		}
	}
}
